package com.example.demo.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.demo.annotation.JsonRes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/aspect")
public class TestAspect {
    private static final Logger logger = LoggerFactory.getLogger(TestAspect.class);

    @RequestMapping("/test")
    @JsonRes("OA")
    public JSONObject testAspect() {
        logger.info("进入接口。。。。");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("code", 200);
        JSONObject jsonObject2 = new JSONObject();
        jsonObject2.put("name", "yby");
        jsonObject2.put("age", 20);
        jsonObject2.put("sex", "女");
        jsonObject.put("data", jsonObject2);
        jsonObject.put("msg", "操作成功！");
        return jsonObject;
    }
}
